<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title><?php echo $cfg_generator;?>后台管理中心</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../plugin/iconfont/iconfont.css">
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/jquery.nicescroll.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/layindex.js"></script>
<script src="../plugin/layer/layer.js"></script>
<style type="text/css">
h1{font-weight:normal;font-size:12px}
.iconfont{color:#fff;font-size: 14px;}
</style>
</head>
<body class="indexbody">
  <!--/全局菜单-->
  <div class="main-top">
  <div class="sitelist">	
  <?php
		$dosql->Execute("SELECT * FROM `#@__site` ORDER BY id ASC");
		if($dosql->GetTotalRow() > 1)
		{
			while($sit = $dosql->GetArray())
			{
				if($_SESSION['siteid'] == $sit['id'])
				{
					$sitekey=$sit['sitekey'].'nav';
					$sitename=$sit['sitename'];
					$light = 'class="on"';}
				else
					$light = '';
		
				echo '<a href="javascript:;" id="'.$sit['sitekey'].'" onclick="SelSite(\''.$sit['sitekey'].'\')" '.$light.' title="切换到'.$sit['sitename'].'">'.$sit['sitename'].'</a>';
			}
		}
		
		else{
			while($sit = $dosql->GetArray())
			$sitename=$sit['sitename'];
			$sitekey=$sit['sitekey'].'nav';

		}
		?></div>
    <a class="icon-menu"></a>
    <div id="main-nav" class="main-nav" style="">
	<?php echo AdminNav();?>	
	</div>

    <div class="nav-right">
	
      <div class="info">
        <i></i>
        <span>
          您好，<?php echo $_SESSION['admin']; ?><br>
          <?php $r = $dosql->GetOne("SELECT `groupname` FROM `#@__admingroup` WHERE `id`=".$_SESSION['adminlevel']);echo ($levelname = isset($r['groupname']) ? $r['groupname'] : '未启用的组'); ?>
		 
        </span>
      </div>
      <div class="option">
        <i></i>
        <div class="drop-wrap">
          <div class="arrow"></div>
          <ul class="item">
            <li>
              <a href="../" target="_blank">预览网站</a>
            </li>
            <li>
              <a href="home.php" target="mainframe">管理首页</a>
            </li>
            <li>
              <a href="admin_update.php?id=<?php $row = $dosql->GetOne("SELECT `id` FROM `#@__admin` WHERE username='".$_SESSION['admin']."'");echo $row['id'];?>" onclick="linkMenuTree(false, '');" target="mainframe">修改密码</a>
            </li>
            <li>
              <a href="logout.php">注销登录</a>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  
  <div class="main-left">
    <h1 class="logo"></h1>
    <div id="sidebar-nav" class="sidebar-nav">
	<?php 
	$dosql->Execute("SELECT * FROM `#@__navigation` WHERE `checkinfo`='false' AND parentid=0  ORDER BY orderid,id ASC ");
		 $z=0;
		while($row = $dosql->GetArray())
			{ 
			$z++;	
			if($z==1) $disply='display: block';else $disply='display: none';
			$img=$row['picurl'];
		echo'
	<div class="list-group" id="'.$row['idname'].'" style="'.$disply.'">
		<h1 title="'.$row['classname'].'"><i class="iconfont '.$img.'"></i></h1>
		<div class="list-wrap">
			<h2>'.$row['classname'].'管理<i></i></h2>
			<ul style="display: block;">';
			if($row['idname']=='nav_content'){echo ShowContent($sitename,$sitekey,$row['id']);}
			
				$dosql->Execute("SELECT * FROM `#@__navigation` WHERE  `checkinfo`='false' AND parentid=".$row['id']." order by orderid,id ASC",$row['id']);
				$y=0;
					while($r = $dosql->GetArray($row['id']))
					{$y++;
					if($y==1) $disply2='display: block';else $disply2='display: none';
					if($r['linkurl']!='') $lmlinkurl= 'href="'.$r['linkurl'].'"';else $lmlinkurl ='';
						echo '<li>
					<a '.$lmlinkurl.' onclick="DisplayMenuT(\'twomenu'.$r['idname'].'\');" target="mainframe">
					<i class="icon folder"></i><span>'.$r['classname'].'</span>
					<b id="btwomenu'.$r['idname'].'" class="expandable close"></b></a>
					<ul id="twomenu'.$r['idname'].'" style="'.$disply2.'">';
		$dosql->Execute("SELECT * FROM `#@__navigation` WHERE `checkinfo`='false' AND parentid=".$r['id']."  ORDER BY orderid,id ASC ",$r['id']);
			while($r2 = $dosql->GetArray($r['id']))
				{	
					$rr=$dosql->GetOne("SELECT count(*) as total FROM `#@__navigation` WHERE `checkinfo`='false' AND parentid=".$r2['id']." ORDER BY orderid,id ASC ");	
					if($rr['total']>0){
						if($r2['linkurl']!='') $lmlinkurl= 'href="'.$r2['linkurl'].'"';else $lmlinkurl ='';
				echo'<li>
							<a '.$lmlinkurl.' onclick="DisplayMenu(\'leftmenu'.$r2['idname'].'\');" target="mainframe">
							<i class="icon"></i><i class="icon folder"></i><span>'.$r2['classname'].'</span>
							<b id="bleftmenu'.$r2['idname'].'" class="expandable close"></b></a>
							<ul id="leftmenu'.$r2['idname'].'" style="display: none;">';
							$dosql->Execute("SELECT * FROM `#@__navigation` WHERE `checkinfo`='false' AND parentid=".$r2['id']."  ORDER BY orderid,id ASC ",$r2['id']);
					while($r3 = $dosql->GetArray($r2['id']))
						{
						echo'
								<li>
								<a id="'.$r3['idname'].'" href="'.$r3['linkurl'].'" target="mainframe">
								<i class="icon"></i><i class="icon"></i><i class="icon file"></i><span>'.$r3['classname'].'</span>
								</a>
								</li>
							';}
							
						echo'</ul></li>';}
						else echo'<li>
								<a id="'.$r2['idname'].'" href="'.$r2['linkurl'].'" target="mainframe">
								<i class="icon"></i><i class="icon file"></i><span>'.$r2['classname'].'</span>
								</a>
								</li>';
						;
					}
			
						echo '
					</ul>
				</li>';
					}
				
		echo'</ul>
		</div>
	</div>';
			
		}
			
			?>
<?php
function ShowContent($sitename,$sitekey,$id)
	{	global $dosql,$cfg_siteid;
	echo '<li>
<a class="channel_main"  onclick="DisplayMenu(\''.$sitekey.'\');" target="mainframe">
<i class="icon folder"></i><span>'.$sitename.'</span>
<b id="b'.$sitekey.'" class="expandable open"></b></a>
<ul id="'.$sitekey.'" style="display: block;">
<li>';

	$dosql->Execute("SELECT * FROM `#@__infoclass` WHERE siteid='$cfg_siteid' AND `checkinfo`=true AND parentid=0  ORDER BY orderid ASC",$id);
			$i = 100;
			while($row = $dosql->GetArray($id))
			{	@$prows[$row['id']] = $row['classname'];
				foreach($prows as $Pid=>$Pname)
			?>

			<?php
				if(IsCategoryPriv($Pid,'list',$cfg_siteid,0))
			{
			?>

<a onclick="DisplayMenu('leftmenu<?php echo $i; ?>');"  target="mainframe">
<i class="icon"></i><i class="icon folder"></i><span><?php echo $Pname;?></span>
<b id="bleftmenu<?php echo $i; ?>" class="expandable <?php if($i=='100') echo 'open';else echo 'close';?>"></b>
</a>
<ul id="leftmenu<?php echo $i; ?>" style="<?php if($i=='100') echo 'display: block';else echo 'display: none';?>">
<?php
					switch($row['infotype'])
					{
						case 0://单页
						echo '<li><a href="info.php?cid='.$row['id'].'" target="mainframe"><i class="icon"></i><i class="icon"></i><i class="icon file"></i><span>内容管理</span></a></li>';	

						break;
						case 1://列表
						
							if(IsCategoryPriv($row['id'],'list',$cfg_siteid,0))
							{
								echo '<li><a href="infolist.php?cid='.$row['id'].'" target="mainframe"><i class="icon"></i><i class="icon"></i><i class="icon file"></i><span>内容管理</span></a></li>';
							}
							else
							{
								echo '';
							}
						break;
						case 4://商品
							if(IsCategoryPriv($row['id'],'list',$cfg_siteid,0))
							{
								echo '<li><a href="goods.php?cid='.$row['id'].'" target="mainframe" ><i class="icon"></i><i class="icon"></i><i class="icon file"></i><span>内容管理 </span></a></li>';
							}
							else
							{
								echo '';
							}
						break;
						default: //自定义模型
								$r = $dosql->GetOne("SELECT * FROM `#@__diymodel` WHERE `id`=".$row['infotype']);
								if(isset($r) && is_array($r))
								{
									if(IsCategoryPriv($row['id'],'list',$cfg_siteid,0)){
										echo '<li><a href="'.$r['modelurl'].'?m='.$r['modelname'].'&cid='.$row['id'].'" target="mainframe"><i class="icon"></i><i class="icon"></i><i class="icon file"></i><span>'.$row['classname'].'</span></a></li>';

										}
								}
				}
				?>
		
</ul>

<?php
				$i++;
			}		
		}
	
	echo '</li></ul></li>';
}
			?>



</div>
  </div>
  
  <div class="main-container">
    <iframe id="mainframe" name="mainframe" frameborder="0" src="home.php"></iframe>
  </div>


<div id="GWDANG_HAS_BUILT"></div></body></html>